/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "orgao_documento", catalog = "salao", schema = "public")
@NamedQueries({
    @NamedQuery(name = "OrgaoDocumento.findAll", query = "SELECT o FROM OrgaoDocumento o")})
public class OrgaoDocumento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "orgao_documento_id_documento_seq")
    @SequenceGenerator(name = "orgao_documento_id_documento_seq", sequenceName = "orgao_documento_id_documento_seq", initialValue = 1, allocationSize = 1)
    @Basic(optional = false)
    @Column(name = "id_orgao", nullable = false)
    private Integer idOrgao;
    @Size(max = 50)
    @Column(name = "dsc_orgao", length = 50)
    private String dscOrgao;
    @Size(max = 50)
    @Column(name = "dsc_assunto", length = 50)
    private String dscAssunto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idOrgao")
    @LazyCollection(LazyCollectionOption.FALSE)
    @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    private List<OrgaoDocumentoLista> orgaoDocumentoListaList;

    public OrgaoDocumento() {
    }

    public OrgaoDocumento(Integer idOrgao) {
        this.idOrgao = idOrgao;
    }

    public Integer getIdOrgao() {
        return idOrgao;
    }

    public void setIdOrgao(Integer idOrgao) {
        this.idOrgao = idOrgao;
    }

    public String getDscOrgao() {
        return dscOrgao;
    }

    public void setDscOrgao(String dscOrgao) {
        this.dscOrgao = dscOrgao;
    }

    public String getDscAssunto() {
        return dscAssunto;
    }

    public void setDscAssunto(String dscAssunto) {
        this.dscAssunto = dscAssunto;
    }

    public List<OrgaoDocumentoLista> getOrgaoDocumentoListaList() {
        return orgaoDocumentoListaList;
    }

    public void setOrgaoDocumentoListaList(List<OrgaoDocumentoLista> orgaoDocumentoListaList) {
        this.orgaoDocumentoListaList = orgaoDocumentoListaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOrgao != null ? idOrgao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrgaoDocumento)) {
            return false;
        }
        OrgaoDocumento other = (OrgaoDocumento) object;
        if ((this.idOrgao == null && other.idOrgao != null) || (this.idOrgao != null && !this.idOrgao.equals(other.idOrgao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.financeiro.entity.OrgaoDocumento[ idOrgao=" + idOrgao + " ]";
    }
    
}
